from django.contrib.auth.models import AbstractUser
from django.db import models


# Create your models here.


class User(AbstractUser):
    mobile = models.CharField(max_length=11, unique=True, null=True, verbose_name='手机号')
    open_id = models.IntegerField(null=True, verbose_name='第三方登陆open_id')

    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name


class UserInfo(models.Model):
    GENDER_CHOICES = (
        (0, 'male'),
        (1, 'female')
    )

    user_id = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="用户")
    address = models.CharField(max_length=150, null=True, blank=True, verbose_name="用户地址")
    school = models.CharField(max_length=64, null=True, blank=True, verbose_name='学校')
    company = models.CharField(max_length=64, null=True, blank=True, verbose_name='用户所在公司')
    persurl = models.CharField(max_length=200, null=True, blank=True, verbose_name='用户个人网址')
    persintro = models.CharField(max_length=200, null=True, blank=True, verbose_name='用户个人简介')
    birthday = models.CharField(max_length=64, null=True, blank=True, verbose_name='生日')
    gender = models.SmallIntegerField(choices=GENDER_CHOICES, default=0, verbose_name='性别')
    city = models.CharField(max_length=64, null=True, blank=True, verbose_name='城市')
    nick_name = models.CharField(max_length=10,null=True, blank=True, verbose_name='用户昵称')
